public class Renderer2D extends NodeSub {
	private static int anInt1420;
	private static boolean aBoolean1421;
	private static boolean aBoolean1422 = true;
	public static int[] pixels;
	public static int width;
	public static int height;
	public static int topY;
	public static int bottomY;
	public static int topX;
	public static int bottomX;
	public static int endX;
	public static int middleX;
	public static int anInt1433;
	public static boolean aBoolean1434;

	public static void method455(int height, int width, int[] pixels) {
		Renderer2D.pixels = pixels;
		Renderer2D.width = height;
		Renderer2D.height = width;
		Renderer2D.method457(0, 0, width, height, true);
	}

	public static void method456() {
		Renderer2D.topX = 0;
		Renderer2D.topY = 0;
		Renderer2D.bottomX = Renderer2D.width;
		Renderer2D.bottomY = Renderer2D.height;
		Renderer2D.endX = Renderer2D.bottomX - 1;
		Renderer2D.middleX = Renderer2D.bottomX / 2;
	}

	public static void method457(int i, int i_1_, int i_2_, int i_3_, boolean bool) {
		if (i_1_ < 0) {
			i_1_ = 0;
		}
		if (i < 0) {
			i = 0;
		}
		if (i_3_ > Renderer2D.width) {
			i_3_ = Renderer2D.width;
		}
		if (i_2_ > Renderer2D.height) {
			i_2_ = Renderer2D.height;
		}
		Renderer2D.topX = i_1_;
		Renderer2D.topY = i;
		Renderer2D.bottomX = i_3_;
		Renderer2D.bottomY = i_2_;
		if (bool) {
			Renderer2D.endX = Renderer2D.bottomX - 1;
			Renderer2D.middleX = Renderer2D.bottomX / 2;
			Renderer2D.anInt1433 = Renderer2D.bottomY / 2;
		}
	}

	public static void method458(int i) {
		int i_4_ = Renderer2D.width * Renderer2D.height;
		if (i != 4) {
			Renderer2D.aBoolean1421 = !Renderer2D.aBoolean1421;
		}
		for (int i_5_ = 0; i_5_ < i_4_; i_5_++) {
			Renderer2D.pixels[i_5_] = 0;
		}
	}

	public static void method459(boolean bool, int i, int i_6_, int i_7_, int i_8_, int i_9_,
		int i_10_) {
		if (i_10_ < Renderer2D.topX) {
			i_7_ -= Renderer2D.topX - i_10_;
			i_10_ = Renderer2D.topX;
		}
		if (i_6_ < Renderer2D.topY) {
			i_8_ -= Renderer2D.topY - i_6_;
			i_6_ = Renderer2D.topY;
		}
		if (i_10_ + i_7_ > Renderer2D.bottomX) {
			i_7_ = Renderer2D.bottomX - i_10_;
		}
		if (i_6_ + i_8_ > Renderer2D.bottomY) {
			i_8_ = Renderer2D.bottomY - i_6_;
		}
		int i_11_ = 256 - i_9_;
		int i_12_ = (i >> 16 & 0xff) * i_9_;
		int i_13_ = (i >> 8 & 0xff) * i_9_;
		int i_14_ = (i & 0xff) * i_9_;
		if (bool) {
			Renderer2D.aBoolean1421 = !Renderer2D.aBoolean1421;
		}
		int i_15_ = Renderer2D.width - i_7_;
		int i_16_ = i_10_ + i_6_ * Renderer2D.width;
		for (int i_17_ = 0; i_17_ < i_8_; i_17_++) {
			for (int i_18_ = -i_7_; i_18_ < 0; i_18_++) {
				int i_19_ = (Renderer2D.pixels[i_16_] >> 16 & 0xff) * i_11_;
				int i_20_ = (Renderer2D.pixels[i_16_] >> 8 & 0xff) * i_11_;
				int i_21_ = (Renderer2D.pixels[i_16_] & 0xff) * i_11_;
				int i_22_ = ((i_12_ + i_19_ >> 8 << 16) + (i_13_ + i_20_ >> 8 << 8) + (i_14_
					+ i_21_ >> 8));
				Renderer2D.pixels[i_16_++] = i_22_;
			}
			i_16_ += i_15_;
		}
	}

	public static void method460(int i, int i_23_, int i_24_, byte i_25_, int i_26_, int i_27_) {
		if (i_27_ < Renderer2D.topX) {
			i_26_ -= Renderer2D.topX - i_27_;
			i_27_ = Renderer2D.topX;
		}
		if (i_23_ < Renderer2D.topY) {
			i -= Renderer2D.topY - i_23_;
			i_23_ = Renderer2D.topY;
		}
		if (i_27_ + i_26_ > Renderer2D.bottomX) {
			i_26_ = Renderer2D.bottomX - i_27_;
		}
		if (i_23_ + i > Renderer2D.bottomY) {
			i = Renderer2D.bottomY - i_23_;
		}
		int i_28_ = Renderer2D.width - i_26_;
		int i_29_ = i_27_ + i_23_ * Renderer2D.width;
		for (int i_30_ = -i; i_30_ < 0; i_30_++) {
			for (int i_31_ = -i_26_; i_31_ < 0; i_31_++) {
				Renderer2D.pixels[i_29_++] = i_24_;
			}
			i_29_ += i_28_;
		}
		if (i_25_ != -24) {
			/* empty */
		}
	}

	public static void method461(int i, int i_32_, int i_33_, int i_34_, int i_35_, int i_36_) {
		Renderer2D.method463(i_35_, i_34_, i_32_, i_36_, true);
		Renderer2D.method463(i_35_, i_34_, i_32_ + i_33_ - 1, i_36_, true);
		if (i != 0) {
			Renderer2D.anInt1420 = -278;
		}
		Renderer2D.method465(i_35_, i_34_, i_33_, false, i_32_);
		Renderer2D.method465(i_35_ + i_36_ - 1, i_34_, i_33_, false, i_32_);
	}

	public static void method462(int i, int i_37_, int i_38_, int i_39_, int i_40_, int i_41_,
		byte i_42_) {
		if (i_42_ == -113) {
			Renderer2D.method464(i_40_, i, i_37_, 1388, i_41_, i_38_);
			Renderer2D.method464(i_40_ + i_39_ - 1, i, i_37_, 1388, i_41_, i_38_);
			if (i_39_ >= 3) {
				Renderer2D.method466(0, i_40_ + 1, i, i_38_, i_39_ - 2, i_41_);
				Renderer2D.method466(0, i_40_ + 1, i + i_37_ - 1, i_38_, i_39_ - 2, i_41_);
			}
		}
	}

	public static void method463(int i, int i_43_, int i_44_, int i_45_, boolean bool) {
		if (i_44_ >= Renderer2D.topY && i_44_ < Renderer2D.bottomY) {
			if (i < Renderer2D.topX) {
				i_45_ -= Renderer2D.topX - i;
				i = Renderer2D.topX;
			}
			if (i + i_45_ > Renderer2D.bottomX) {
				i_45_ = Renderer2D.bottomX - i;
			}
			int i_46_ = i + i_44_ * Renderer2D.width;
			if (!bool) {
				for (int i_47_ = 1; i_47_ > 0; i_47_++) {
					/* empty */
				}
			}
			for (int i_48_ = 0; i_48_ < i_45_; i_48_++) {
				Renderer2D.pixels[i_46_ + i_48_] = i_43_;
			}
		}
	}

	public static void method464(int i, int i_49_, int i_50_, int i_51_, int i_52_, int i_53_) {
		if (i >= Renderer2D.topY && i < Renderer2D.bottomY) {
			if (i_49_ < Renderer2D.topX) {
				i_50_ -= Renderer2D.topX - i_49_;
				i_49_ = Renderer2D.topX;
			}
			if (i_49_ + i_50_ > Renderer2D.bottomX) {
				i_50_ = Renderer2D.bottomX - i_49_;
			}
			int i_54_ = 256 - i_52_;
			int i_55_ = (i_53_ >> 16 & 0xff) * i_52_;
			int i_56_ = (i_53_ >> 8 & 0xff) * i_52_;
			int i_57_ = (i_53_ & 0xff) * i_52_;
			int i_58_ = i_49_ + i * Renderer2D.width;
			for (int i_59_ = 0; i_59_ < i_50_; i_59_++) {
				int i_60_ = (Renderer2D.pixels[i_58_] >> 16 & 0xff) * i_54_;
				int i_61_ = (Renderer2D.pixels[i_58_] >> 8 & 0xff) * i_54_;
				int i_62_ = (Renderer2D.pixels[i_58_] & 0xff) * i_54_;
				int i_63_ = ((i_55_ + i_60_ >> 8 << 16) + (i_56_ + i_61_ >> 8 << 8) + (i_57_
					+ i_62_ >> 8));
				Renderer2D.pixels[i_58_++] = i_63_;
			}
			if (i_51_ != 1388) {
				Renderer2D.anInt1420 = -36;
			}
		}
	}

	public static void method465(int i, int i_64_, int i_65_, boolean bool, int i_66_) {
		if (!bool && (i >= Renderer2D.topX && i < Renderer2D.bottomX)) {
			if (i_66_ < Renderer2D.topY) {
				i_65_ -= Renderer2D.topY - i_66_;
				i_66_ = Renderer2D.topY;
			}
			if (i_66_ + i_65_ > Renderer2D.bottomY) {
				i_65_ = Renderer2D.bottomY - i_66_;
			}
			int i_67_ = i + i_66_ * Renderer2D.width;
			for (int i_68_ = 0; i_68_ < i_65_; i_68_++) {
				Renderer2D.pixels[i_67_ + i_68_ * Renderer2D.width] = i_64_;
			}
		}
	}

	public static void method466(int i, int i_69_, int i_70_, int i_71_, int i_72_, int i_73_) {
		if (i_70_ >= Renderer2D.topX && i_70_ < Renderer2D.bottomX) {
			if (i_69_ < Renderer2D.topY) {
				i_72_ -= Renderer2D.topY - i_69_;
				i_69_ = Renderer2D.topY;
			}
			if (i_69_ + i_72_ > Renderer2D.bottomY) {
				i_72_ = Renderer2D.bottomY - i_69_;
			}
			int i_74_ = 256 - i_73_;
			int i_75_ = (i_71_ >> 16 & 0xff) * i_73_;
			int i_76_ = (i_71_ >> 8 & 0xff) * i_73_;
			int i_77_ = (i_71_ & 0xff) * i_73_;
			if (i != 0) {
				for (int i_78_ = 1; i_78_ > 0; i_78_++) {
					/* empty */
				}
			}
			int i_79_ = i_70_ + i_69_ * Renderer2D.width;
			for (int i_80_ = 0; i_80_ < i_72_; i_80_++) {
				int i_81_ = (Renderer2D.pixels[i_79_] >> 16 & 0xff) * i_74_;
				int i_82_ = (Renderer2D.pixels[i_79_] >> 8 & 0xff) * i_74_;
				int i_83_ = (Renderer2D.pixels[i_79_] & 0xff) * i_74_;
				int i_84_ = ((i_75_ + i_81_ >> 8 << 16) + (i_76_ + i_82_ >> 8 << 8) + (i_77_
					+ i_83_ >> 8));
				Renderer2D.pixels[i_79_] = i_84_;
				i_79_ += Renderer2D.width;
			}
		}
	}
}
